#ifndef ERRORLOGDIALOG_H
#define ERRORLOGDIALOG_H

#include "BaseUI.h"
#include <QWidget>
#include <QTableWidget>
#include <QLineEdit>

#include "../patterns/Observer.h"

namespace ui {

class ErrorLogDialog: public BaseUI, public patterns::Observer {
    Q_OBJECT

    QTableWidget *lstErr;
    QLineEdit *txtFilter;

    bool filtered;

public:
    ErrorLogDialog(QWidget*);
    bool setup();
    void update(patterns::Observable*, void*); // Observer

private:
    void insertRow(QTableWidgetItem *time, QTableWidgetItem *msg, QTableWidgetItem *sender);
    void extractParams(const std::wstring &msg, short &type, std::wstring &txt);
    QColor getColorForType(const short &type);

    void insertItems(core::LogEntry*);

private slots:
    void onClear();
    void onApplyFilter();
    void onResetFilter();
};

}

#endif // ERRORLOGDIALOG_H
